Subtree proofs, landmarks, and signatureless certificates - #96
Merged
Conversation
bwesterb
reviewed
Aug 26, 2025
lukevalenta
commented
Aug 26, 2025
bwesterb
reviewed
Aug 26, 2025
bwesterb
reviewed
Aug 26, 2025
bwesterb
requested changes
Aug 26, 2025
bwesterb
left a comment
Member
There was a problem hiding this comment.
See previous comments on PR.
bwesterb
self-requested a review
August 26, 2025 17:55
bwesterb
approved these changes
Aug 26, 2025
bwesterb
left a comment
Member
There was a problem hiding this comment.
Feel free to merge already if that makes future PRs smaller.
Later, we'll use the same subroutine to generate both types of proofs, so it's useful to merge them into a single type.
This commit does not add any new functionality, but does some
refactoring like adjusting functions and APIs.
* Rename 'check_{inclusion,consistency}' functions to
'verify_{inclusion,consistency}' for closer alignment to the spec.
* Rename function parameters for consistency (e.g., use 'n' for larger
tree, 'm' for smaller tree, 'leaf_index' for leaf index)
* Add '_recursion' suffix to '{inclusion,consistency}_proof[_indexes]'
functions and make them private (these will be replaced in a later
commit). Rename 'prove_{inclusion,consistency}' to
'{inclusion,consistency}_proof' for closer alignment with naming in
spec, and add corresponding '*_indexes' functions that do bounds
checks for safe public consumption.
* Add ProofError type to help distinguish between proof errors and
server errors.
* Move TlogError enum to the top of the source file.
* Add Subtree struct to represent a valid subtree. (More functionality will be added later.) * Add support for subtree inclusion and consistency proof verification. * Replace recursive proof verification functions with ones aligned with the specifications.
* Add _internal suffix to subtree_hash and subtree_indexes functions. These will get removed later. * Add subtree_hash_indexes, subtree_hash, and tree_hash_indexes functions with better API for public consumption.
SUBTREE_SUBPROOF generalizes the logic to compute inclusion and consistency proofs, so we can use the `Subtree::subproof` function to compute all of the various proof types. * Add support for subtree consistency proofs. * Deduplicate subtree recursion logic with 'walk_subtree' helper. * Deduplicate merkle tree hash logic with 'walk_hash' helper. * Remove all of the _internal/_recursion helper functions as those have been replaced.
* Add subtree inclusion and consistency proof support in log_ops. * Update prove_inclusion and prove_consistency to verify the computed proofs, fetching additional tiles from object storage as needed. The subtree inclusion proofs will be used for computing Merkle Tree Certificate 'mtcProof' signatures, and the subtree consistency proofs will be useful for constructing proofs that landmark subtrees are consistent with some checkpoint.
* Add support for landmark checkpoints. * Update /prove-inclusion to compute subtree inclusion proofs within landmark subtrees. * Add checkpoint callback function that gets called every time sequencing completes with the new tree size and old and new timestamps. Importantly, if the callback fails, it does NOT count as a fatal sequencing error. This is used for updating the landmark sequence for the MTC sequencer. * Rename validity_interval_seconds to max_certificate_lifetime_secs.
- Convert MTC /prove-inclusion endpoint to /get-certificate to return a signatureless certificate. - Add read_leaf function to read and verify the needed tiles and then extract the data at a single leaf index. This is used to fetch a MerkleTreeCertificateLogEntry in order to construct a signatureless certificate. - Add support for serializing a signatureless certificate and constructing the MTCProof from a subtree inclusion proof.
Use language from ietf-plants-wg/merkle-tree-certs#139 which aims to clarify some ambiguities.
lukevalenta
force-pushed
the
lvalenta/subtree-proofs
branch
from
August 28, 2025 04:25
bbf8a2e to
c04339b
Compare
rozbb
approved these changes
Aug 29, 2025
We have to fetch additional tiles (to compute the leaf and landmark subtree hashes) to validate subtree inclusion proofs right after we've constructed the proof. Remove validation from the hot path as we have bettter testing now and don't expect to create invalid proofs.
cjpatton
reviewed
Aug 29, 2025
cjpatton
left a comment
Contributor
There was a problem hiding this comment.
Working my way through, just a few minor things so far.
* Use debug_assert instead of assert in tlog library * Improve documentation and variable naming for stored hash index * Add link to spec for subtree definition
lukevalenta
force-pushed
the
lvalenta/subtree-proofs
branch
from
September 2, 2025 21:21
c3d0239 to
de527e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for subtree proofs, landmarks, and signatureless certificates. I recommend going commit by commit as some of them do refactoring.
Closes #64
Some features that I haven't added yet, but will file issues for in case we want to add them in the future: